home *** CD-ROM | disk | FTP | other *** search
/ Mac Mania 2 / MacMania 2.toast / Demo's / Tools&Utilities / System Utilities / Smooth Updates 0.9 / source / Useful.h < prev   
Encoding:
Text File  |  1992-06-28  |  3.2 KB  |  117 lines  |  [TEXT/KAHL]

  1. typedef unsigned char  uchar;
  2. typedef unsigned short ushort;
  3. typedef unsigned long  ulong;
  4.  
  5. extern struct Keyboard {
  6.     short    wasted;
  7.     short    wasted2;
  8.     short    wasted3;
  9.     int command : 1;
  10.     int : 5;
  11.     int space : 1;
  12.     int tab : 1;
  13.     int : 4;
  14.     int control : 1;
  15.     int option : 1;
  16.     int capslock : 1;
  17.     int shift : 1;
  18. } keymap : 0x174;
  19.  
  20. // theQDPort() is a quick way of getting the current port without having to
  21. // call GetPort.
  22.  
  23. #pragma parameter __A0 theQDPort()
  24. pascal GrafPtr theQDPort(void) = { 0x2055, 0x2050 };
  25.  
  26. // SetA4 is an inline for setting register a4 without using inline assembly.
  27. // it returns the old value of a4.
  28.  
  29. #pragma parameter __A0 SetA4(__A0)
  30. pascal void *SetA4(void *newA4) = 0xC948;
  31.  
  32. // CopyHandle is a better interface to HandToHand.
  33.  
  34. #pragma parameter __A0 CopyHandle(__A0)
  35. pascal void *CopyHandle(void *) = {0xA9E1};
  36.  
  37. // qGetHandleSize is just GetHandleSize, without the error checks.
  38.  
  39. #pragma parameter __D0 qGetHandleSize(__A0)
  40. pascal Size qGetHandleSize(void *h) = 0xA025;
  41.  
  42. // HandleOf is a better interface to PtrToHand
  43.  
  44. #pragma parameter __A0 HandleOf(__A0, __D0)
  45. pascal void *HandleOf(void *, long) = {0xA9E3};
  46.  
  47. // ClearSpace is a trivial inline for clearing space out.
  48.  
  49. #pragma parameter ClearSpace(__A0, __D0)
  50. pascal void ClearSpace(void *, long) = {0x4218, 0x5380, 0x66FA};
  51.  
  52. // QuickMove is faster than BlockMove for small moves. (and doesn't clear the cache)
  53.  
  54. #pragma parameter QuickMove(__A0, __A1, __D0)
  55. pascal void QuickMove(void *from, void *to, short bytes) = {0x12D8, 0x5340, 0x66FA};
  56.  
  57. // MakeALong makes a long out of two shorts efficiently.
  58.  
  59. #pragma parameter __D0 MakeALong(__D0, __D1)
  60. pascal long MakeALong(short HiWord, short LoWord) = {0x4840, 0x3001};
  61.  
  62. // MinShort takes the minimum of two input shorts efficiently
  63.  
  64. #pragma parameter __D0 MinShort(__D0, __D1)
  65. pascal short MinShort (short a, short b) = {0xB240, 0x6E02, 0x3001};
  66.  
  67. // MaxShort takes the maximum of two input shorts efficiently
  68.  
  69. #pragma parameter __D0 MaxShort(__D0, __D1)
  70. pascal short MaxShort (short a, short b) = {0xB240, 0x6D02, 0x3001};
  71.  
  72. // qLoWord quickly retrieves the low word of a long..
  73.  
  74. #define qLoWord(l) ((short)(l))
  75.  
  76. // qHiWord quickly retrieves the high word of a long..
  77.  
  78. #pragma parameter __D0 qHiWord(__D0)
  79. pascal short qHiWord(long Long) = {0x4840};
  80.  
  81. // qDelay is a better interface for Delay.
  82.  
  83. #pragma parameter __A0 qDelay(__A0)
  84. pascal long qDelay(long numTicks)
  85.     = {0xA03B}; 
  86.  
  87. // PenWhite calls PenPat(white) from QuickDraw's globals.
  88.  
  89. pascal void PenWhite(void)
  90.     =    {0x2055, 0x4868, 0xFFF8, 0xA89D};
  91.  
  92. // PenBlack calls PenPat(black) from QuickDraw's globals.
  93.  
  94. pascal void PenBlack(void)
  95.     =    {0x2055, 0x4868, 0xFFF0, 0xA89D};
  96.  
  97. // PenGray calls PenPat(gray) from QuickDraw's globals.
  98.  
  99. pascal void PenGray(void)
  100.     =    {0x2055, 0x4868, 0xFFE8, 0xA89D};
  101.  
  102. // ArrowCursor calls SetCursor(arrow) from QuickDraw's globals.
  103.  
  104. pascal void ArrowCursor(void)
  105.     =    {0x2055, 0x4868, 0xFF94, 0xA851};
  106.  
  107. // PStringMove is a quick pascal string copy using the toolbox.
  108.  
  109. #pragma parameter PStringMove(__A0,__A1)
  110. pascal void PStringMove(const void *srcPtr,void *destPtr)
  111.     = {0x7001, 0xD010, 0xA02E}; 
  112.  
  113. // Why HOpenResFile isn't declared this way, I don't know.
  114. // (Under System 7, HORF has its own trap)
  115.  
  116. pascal short HOpenResFile7(short vRefNum,long dirID,ConstStr255Param fileName,
  117.     char permission) = 0xA81A;